package test;
import java.awt.Canvas;
import java.util.ArrayList;
import java.util.PriorityQueue;

import javax.swing.JFrame;

import fu.gps.Spherical;

import nav.CoordinateTopologyObjectImpl;
import nav.CrossingTopologyObjectImpl;
import nav.NavigationImpl;

public class Main {
	
    static JFrame F=new JFrame();
	/**
	 * @param args
	 */
	public static void main(String[] args) {



		final NavigationImpl nav = new NavigationImpl();
//		nav.getFromDatabase(-11.0050640236589756,-11.1860380963103207790907108489,49.395803045619863,49.491470360344979391);
	

		nav.getFromFiles();
		
		
		nav.addPoi(new CoordinateTopologyObjectImpl(-011.08192167,49.44643333));
		nav.addPoi(new CoordinateTopologyObjectImpl(-011.07457667,49.45309667));

		nav.addPoi(new CoordinateTopologyObjectImpl(-011.077572958027802167,49.4535007000));

		nav.addPoi(new CoordinateTopologyObjectImpl(-011.07597043079658027802167,49.45348407000));
		nav.addPoi(new CoordinateTopologyObjectImpl(-011.082258027802167,49.45407000));

		nav.addPoi(new CoordinateTopologyObjectImpl(-011.077958027802167,49.452407000));

		nav.addPoi(new CoordinateTopologyObjectImpl(-011.07872833,49.45099333));
		nav.addPoi(new CoordinateTopologyObjectImpl(-011.07800167,49.45278833));
		nav.addPoi(new CoordinateTopologyObjectImpl(-011.07534833,49.44784167));
		nav.addPoi(new CoordinateTopologyObjectImpl(-011.07682000,49.45281167));
		nav.addPoi(new CoordinateTopologyObjectImpl(-011.08782000,49.45281167));
		nav.addPoi(new CoordinateTopologyObjectImpl(-011.07296667,49.45303000));
		nav.addPoi(new CoordinateTopologyObjectImpl(-011.07482667,49.45849000));
		nav.addPoi(new CoordinateTopologyObjectImpl(-011.07454500,49.455767333));
		nav.addPoi(new CoordinateTopologyObjectImpl(-011.007088167,49.45416000));
		nav.addPoi(new CoordinateTopologyObjectImpl(-011.07152333,49.45617667));
		nav.addPoi(new CoordinateTopologyObjectImpl(-011.037395000,49.425712667));
//		nav.addPoi(new CoordinateTopologyObjectImpl(-011.07654500,49.45767333));
//		nav.addPoi(new CoordinateTopologyObjectImpl(-011.08166233,49.457541667));
		nav.addPoi(new CoordinateTopologyObjectImpl(-011.1507285000,49.457281267));
		nav.addPoi(new CoordinateTopologyObjectImpl(-011.07622450,49.458577333));


		nav.executeNavigation();
		
        F.setTitle("Test");
        F.setSize(300,900);
        F.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Canvas c = new TestCanvas(nav);
        F.add(c);
        F.setVisible(true);

//        double f=nav.topology.crossings.get(80656).getLink(nav.topology.crossings.get(80798)).length();
//        double fb=Spherical.greatCircleMeters(nav.topology.crossings.get(80798).getCoordinate().getY(),
//        								nav.topology.crossings.get(80798).getCoordinate().getX(), 
//        								nav.topology.crossings.get(79852).getCoordinate().getY(), 
//        								nav.topology.crossings.get(79852).getCoordinate().getX());
//        double fsum=f+fb;
//        
//
//        double f2=nav.topology.crossings.get(80656).getLink(nav.topology.crossings.get(80655)).length();
//        double f2b=Spherical.greatCircleMeters(nav.topology.crossings.get(80655).getCoordinate().getY(),
//        								nav.topology.crossings.get(80655).getCoordinate().getX(), 
//        								nav.topology.crossings.get(79852).getCoordinate().getY(), 
//        								nav.topology.crossings.get(79852).getCoordinate().getX());
//        double f2sum = f2+f2b;
//        System.out.println("80656 -> 80798:" +f+" + "+ fb + " = "+fsum);
//        System.out.println("80656 -> 80655:" +f2+" + "+f2b +" ="+f2sum);
        


        F.setVisible(true);



      

	}
	

}
